# This is a Makefile for compiling Fall 2010 CSE 167 projects.
# It includes all .cpp files in the current directory.
# To use on a different (non-lab) Linux setup, change the INCDIRS and LIBDIRS
#   directories to point to the locations of the header files on your machine.
NAME	= program
ECHO	= @echo
CC	= @g++
LIBS	= -lglut -lGLU -lGL -lXmu -lXi -lGLee -o program 
LDFLAGS	= $(LIBS)
CFLAGS	= -DFLYREV -I./library -I ./basecode -g -Weffc++ -Wall -Wextra -I /home/chrijon/GLEE/
SOURCES = $(wildcard *.cpp)
HEADERS = $(wildcard *.h)
SOURCESANDHEADERS = $(SOURCES) $(HEADERS)
OBJS = $(patsubst %.cpp, %.o, $(SOURCESANDHEADERS))

.cpp.o: 
	$(ECHO) "Compiling $<"
	$(CC) $(CFLAGS) -c -o $@ $< 

$(NAME): $(OBJS)
	$(ECHO) "Linking $@..."
	$(CC) -o $@ *.o $(LIBS)
	$(ECHO) "Built $@!"

depend: .depend

.depend: $(SOURCES) $(HEADERS)
	@rm -f ./.depend 2> /dev/null
	$(CC) $(CFLAGS) -MM $^ >> ./.depend;

include .depend

clean:
	$(RM) core *.o $(NAME)
	$(ECHO) "All clean!"
	rm .depend
	rm .dep.inc
	rm *.warn
new:
	make clean
	make 
